var dbConfig = require('../util/deconfig.js')
//获取用户
 getUserInfo=(req,res)=>{
	var sql = 'SELECT result,number,multiple,chance,open_num AS openNum,if_open AS ifOpen,inumber,creat_ts AS creatTs FROM `gcwinfo` ORDER BY creat_ts DESC LIMIT 0,10'
	var sqlArr = []
	var callBack = (err,data)=>{
		if(err){
			console.log('连接出错了')
		}else{
			//返回数据
			res.send({
				'list': data
			})
		}
	}
	dbConfig.sqlConnect(sql,sqlArr,callBack)
}
//查询中奖的次数
getWinCount=(req,res)=>{
	var sql = 'SELECT id, result,number,multiple,chance,open_num AS openNum,if_open AS ifOpen,inumber,DATE_FORMAT(creat_ts,"%Y-%m-%d") AS creatTs FROM `gcwinfo` WHERE multiple>=5832 ORDER BY creat_ts DESC LIMIT 0,10'
	var sqlArr=[]
	var callBack = (err,data)=>{
		if(err){
			console.log('连接出错')
		}else{
			res.send({
				"list": data
			})
		}
	}
	dbConfig.sqlConnect(sql,sqlArr,callBack)
}

module.exports={
	getUserInfo,
	getWinCount
}